package com.han.nettytestdemo.connector.communication;

import android.util.Log;

import java.util.Arrays;

/**
 * Created by bayi on 2016/2/25.
 * (订单) 模拟，发送命令的形式设计与
 */
public class Order {


    String[][] cmd; //待发送命令
    ProductCallback productCallback; //命令执行结果
    ExecutiveLevel executiveLevel; //执行级别
    ProtocolType protocolType;//协议类型

    public Order(String[][] cmd, final ProductCallback productCallback, ExecutiveLevel executiveLevel) {
        setProductCallback(productCallback);
        setCmd(cmd);
        setExecutiveLevel(executiveLevel);
        Log.d("jjj", "Order: "+ Arrays.asList(cmd));
        this.protocolType = ProtocolType.PLC;
    }

    public Order(String[][] cmd, final ProductCallback productCallback, ExecutiveLevel executiveLevel, ProtocolType protocolType) {
        setProductCallback(productCallback);
        setCmd(cmd);
        setExecutiveLevel(executiveLevel);
        this.protocolType = protocolType;
    }

    public String[][] getCmd() {
        return cmd;
    }

    private void setCmd(String[][] cmd) {
        this.cmd = cmd;
    }

    public ProductCallback getProductCallback() {
        return productCallback;
    }

    private void setProductCallback(ProductCallback productCallback) {
        this.productCallback = productCallback;
    }

    public ExecutiveLevel getExecutiveLevel() {
        return executiveLevel;
    }

    private void setExecutiveLevel(ExecutiveLevel executiveLevel) {
        this.executiveLevel = executiveLevel;
    }

    /***HIGH 必须执行，MEDIUM可以等待，LOW 可以拒绝*/
    public enum ExecutiveLevel {
        HIGH, MEDIUM, LOW
    }

}
